import request from '@/config/axios'
import type { CommodityData } from './types'

export const getTableListApi = (params: any): Promise<IResponse> => {
  return request.get({ url: 'http://localhost:8081/SyOperationController/selProduct2', params })
}

export const getTableListApiPer = (params: any): Promise<IResponse> => {
  return request.get({ url: 'http://localhost:8081/SyOperationController/selPersonalProductList2', params })
}

export const getReviewTheProductList = (params:any) : Promise<IResponse> => {
  return request.post({url: 'http://localhost:8081/SyOperationController/getCommodityAudit2', params})
}

export const selOperationLog = (params:any) : Promise<IResponse> => {
  return request.post({url: 'http://localhost:8081/personnel/selOperationLog2', params})
}

export const selProductLog = (params:any) : Promise<IResponse> => {
  return request.post({url: 'http://localhost:8081/SyOperationController/selProductLog2', params})
}

export const saveCommodityApi = (data: Partial<CommodityData>): Promise<IResponse> => {
  return request.post({ url: '/example/save', data })
}

export const getTableDetApi = (id: string): Promise<IResponse<CommodityData>> => {
  return request.get({ url: '/example/detail', params: { id } })
}


export const delTableListApi = (ids: string[] | number[]): Promise<IResponse> => {
  return request.post({ url: 'http://localhost:8081/SyOperationController/delProduct', data: { ids } })
}

export const delTableListOPerLogApi = (id: string[] | number[]): Promise<IResponse> => {
  return request.post({ url: 'http://localhost:8081/personnel/delOperationLog', data: { id } })
}

